package rexsee.core.transportation;

import rexsee.core.browser.Browser;
import rexsee.core.browser.clazz.JavascriptInterface;

public class RexseeProfessionalUpload extends RexseeUpload
		implements
			JavascriptInterface {

	public static final String INTERFACE_NAME = "ProfessionalUpload";
	@Override
	public String getInterfaceName() {
		return mBrowser.application.resources.prefix + INTERFACE_NAME;
	}
	@Override
	public JavascriptInterface getInheritInterface(Browser childBrowser) {
		return new RexseeProfessionalUpload(childBrowser);
	}

	protected boolean isValidPath(String path) {
		return true;
	}

	public RexseeProfessionalUpload(Browser browser) {
		super(browser);
	}

	public void appendFile(String path) {
		if (!isValidPath(path)) {
			mBrowser.exception(getInterfaceName(), "Invalid path.");
			return;
		}
		selectedFiles.add(path);
	}
	public void selectFile(String path) {
		if (!isValidPath(path)) {
			mBrowser.exception(getInterfaceName(), "Invalid path.");
			return;
		}
		clear();
		selectedFiles.add(path);
	}

}
